package cn.hwadee.muying.recommend;

import static cn.hwadee.muying.recommend.util.ScoreCos.*;

/**
 * @创建人 skiner
 * @创建时间 2018/8/14
 * @描述
 */
public class Worker {
    /**
     * 用户编号
     */
    private long userId;
    /**
     * 期望城市
     */
    private String expectedCity;
    /**
     * 现在状态
     */
    private int status;
    /**
     * 最高学历
     */
    private String education;
    /**
     * 工作经验
     */
    private int experience;
    /**
     * 星座
     */
    private String constellation;
    /**
     * 年龄
     */
    private int age;
    /**
     * 籍贯
     */
    private String nativePlace;
    /**
     * 自我介绍
     */
    private String introduction;
    /**
     * 所在地区
     */
    private String location;

    public int getStatus() {
        return status;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public String getExpectedCity() {
        return expectedCity;
    }

    public void setExpectedCity(String expectedCity) {
        this.expectedCity = expectedCity;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getEducation() {
        return education;
    }

    public void setEducation(String education) {
        this.education = education;
    }

    public int getExperience() {
        return experience;
    }

    public void setExperience(int experience) {
        this.experience = experience;
    }

    public String getConstellation() {
        return constellation;
    }

    public void setConstellation(String constellation) {
        this.constellation = constellation;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getNativePlace() {
        return nativePlace;
    }

    public void setNativePlace(String nativePlace) {
        this.nativePlace = nativePlace;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    @Override
    public String toString() {
        return "Worker{" +
                "userId=" + userId +
                ", expectedCity='" + expectedCity + '\'' +
                ", status=" + status +
                ", education='" + education + '\'' +
                ", experience=" + experience +
                ", constellation='" + constellation + '\'' +
                ", age=" + age +
                ", nativePlace='" + nativePlace + '\'' +
                ", introduction='" + introduction + '\'' +
                ", location='" + location + '\'' +
                '}';
    }

    /**
     * 值越接近1表示越接近
     * @param o
     * @return
     */
    public double distinct(Worker o){
        double dis = 0;
        dis += (3d / 16) * equal(this.expectedCity, o.expectedCity);
        dis += (1d / 16) * equal(this.status, o.status) ;
        dis += (2d / 16) * similarByNumber(this.experience,o.experience,496);
        dis += (2d / 16) * equal(this.education, o.education);
        dis += (2d / 16) * equal(this.constellation, o.constellation);
        dis += (2d / 16) * similarByNumber(this.age,o.age,40);
        dis += (2d / 16) * equal(this.nativePlace, o.nativePlace);
        dis += (1d / 16) * similarScoreCos(this.introduction, o.introduction);
        dis += (1d / 16) * similarScoreCos(this.location, o.location);
        return dis;
    }
}
